Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【new ir】add __eq__ and __hash__ to compare opresult and value #55909

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

xiaoguoguo626807
Copy link
Contributor

@xiaoguoguo626807 xiaoguoguo626807 commented Aug 2, 2023

PR types

Others

PR changes

Others

Description

pcard-67164

增加opresult 结构和 value 结构判等方法__eq__; hash,使得指向相同地址的opresult 和 value 在python端可以判断正确(==, is, value in opresult_set)

@paddle-bot
Copy link

paddle-bot bot commented Aug 2, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

return false;
}
})
.def("__eq__", &OpResult::operator==)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有了下面的重载,这一句是不是已经不需要了啊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面的判断opresult == value 的重载

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall

.dyn_cast<ir::BoolAttribute>()
.data();
} else {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

若没有定义stop_gradient属性,默认策略是False,这个要留意下后续是否有什么影响

friend Operation;

detail::ValueImpl *value_impl() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么不返回const detail::ValueImpl * ?

Copy link
Contributor

@winter-wang winter-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaoguoguo626807 xiaoguoguo626807 merged commit 8ddf51f into PaddlePaddle:develop Aug 3, 2023
@xiaoguoguo626807 xiaoguoguo626807 deleted the equal branch August 3, 2023 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants